class Comment < ActiveRecord::Base

  has_many :children, :class_name => "Comment", :foreign_key => "father_id"
  belongs_to :father, :class_name => "Comment"
  
  belongs_to :user
  belongs_to :post
  
  validates_presence_of :user
  validates_presence_of :post
  validates_presence_of :description
  
  validates_uniqueness_of :description, :scope => [:user_id, :post_id, :children_id]

end